import request from '../util/axios'
import qs from 'qs'
/*
* 获取登录用户
* */
export function getUserInfo(param,page,pageSize){
    param.page = page;
    param.pageSize=pageSize;
    return request({
        url: '/auth/getUser',
        method: 'post',
        headers:{
            'content-type':'application/x-www-form-urlencoded'
        },
        data:qs.stringify(param)
    })
}

/*
*  找回密码
* */
export function doRetrieve(userId,password_1,password_2){
    let data={
        userId:userId,
        password_1:password_1,
        password_2:password_2
    }
    return request({
        url:'/auth/retrieve',
        method: 'post',
        headers:{
            'content-type':'application/x-www-form-urlencoded'
        },
        data:qs.stringify(data)
    })
}
/*
* 添加用户
* */
export function addUser(data){
    return request({
        url:'/user/addUser',
        method: 'post',
        headers:{
            'content-type':'application/x-www-form-urlencoded'
        },
        data:qs.stringify(data)
    })
}
/*
* 更新用户
* */
export function updateUser(data){
    return request({
        url:'/user/updateUser',
        method: 'post',
        headers:{
            'content-type':'application/x-www-form-urlencoded'
        },
        data:qs.stringify(data)
    })
}

/*
* 删除用户
* */
export function deleteUserById(id){
    return request({
        url:'/user/deleteUserById',
        method: 'get',
        params:{
            userId:id
        }
    })
}

/*
* 查询所有用户
* */
export function selectAllUser(currPage,pageSize){
    return request({
        url:'/user/selectAllUser',
        method: 'get',
        params:{
            currPage:currPage,
            pageSize:pageSize
        }
    })
}
